/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package textfilewriter.entity.fact;

import java.text.SimpleDateFormat;
import java.util.Date;
import textfilewriter.entity.dimension.Customer;

/**
 *
 * @author GiangLT
 */
public class OnDemandService {

    private Date startDate;
    private Date endDate;
    private Customer customer;
    private String service;
    private long usageTime;
    private double fee;
    private int numOfRgus;
    private double totalRevenuePerRgu;

    public OnDemandService() {
    }

    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public double getFee() {
        return fee;
    }

    public void setFee(double fee) {
        this.fee = fee;
    }

    public int getNumOfRgus() {
        return numOfRgus;
    }

    public void setNumOfRgus(int numOfRgus) {
        this.numOfRgus = numOfRgus;
    }

    public String getService() {
        return service;
    }

    public void setService(String service) {
        this.service = service;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public double getTotalRevenuePerRgu() {
        return totalRevenuePerRgu;
    }

    public void setTotalRevenuePerRgu(double totalRevenuePerRgu) {
        this.totalRevenuePerRgu = totalRevenuePerRgu;
    }

    public long getUsageTime() {
        return usageTime;
    }

    public void setUsageTime(long usageTime) {
        this.usageTime = usageTime;
    }
    
    @Override
    public String toString() {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        StringBuilder sb = new StringBuilder();
        sb.append(dateFormat.format(startDate));
        sb.append("|");
        sb.append(dateFormat.format(endDate));
        sb.append("|");
        sb.append(customer.getCustFirstName());
        sb.append(" ");
        sb.append(customer.getCustLastName());
        sb.append("|");
        sb.append(customer.getCustStreetAddress());
        sb.append("|");
        sb.append(service);
        sb.append("|");
        sb.append(usageTime);
        sb.append("|");
        sb.append(fee);

        return sb.toString();
    }

    public String getHeader() {
        return "Start date|End date|Customer name|Customer Address|Service|Usage Time|Fee";
    }
}
